home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / gawk-3.000 / gawk-3 / gawk-3.0.0 / pc / Makefile < prev    next >
Encoding:
Makefile  |  1996-01-09  |  8.9 KB  |  300 lines

  1. # Makefile for gawk (GNU awk)                                   1 Sep 1995
  2. #
  3. # - for GNU C (djgpp)         [executable for DOS (32-bit)]
  4. # - for GNU C (emx)           [executable for OS/2 2.x or DOS (32-bit)]
  5. # - for Microsoft C 7         [ececutable for DOS (16-bit)]
  6. # - for Microsoft C 6.00A     [executable for OS/2 or DOS (16-bit)]
  7. # - for Microsoft C 5.1       [executable for OS/2 or DOS (16-bit)]
  8.  
  9. # Tested with ndmake and dmake-3.8 under DOS and dmake and
  10. # GNU make under OS/2. Compiling with dmake under DOS may require 
  11. # the DOS-only version of dmake (so that swapping works).
  12.  
  13. default:
  14.     @echo "Enter $(MAK) target "
  15.     @echo " where 'target' is chosen from                          " 
  16.     @echo "  djgpp ... DOS 32-bit exe [GNU C, Delorie, v1 or v2]   "
  17.     @echo "  emx ..... OS/2 32-bit exe [emx/gcc; uses emxlibc.dll] "
  18.     @echo "  emxbnd .. OS/2 and DOS 32-bit exe [emx/gcc]           "
  19.     @echo "  msc ..... DOS exe [Microsoft C 7]                     "
  20.     @echo "  msc6 .... DOS exe [Microsoft C 6.00a]                 "
  21.     @echo "  msc6os2 . OS/2 exe [Microsoft C 6.00a]                "
  22.     @echo "  msc6bnd . OS/2 and DOS exe [Microsoft C 6.00a]        "
  23.     @echo "  ----------------------------------------------------- "
  24.     @echo "  test .... Perform tests (see README_d/README.pc)      "
  25.     @echo "  install . Install gawk under $(prefix)/               "
  26.  
  27. # Support dropped in 3.0
  28. #    @echo "  msc51     DOS exe [Microsoft C 5.1]                   "
  29. #    @echo "  msc51bnd  OS/2 and DOS exe [Microsoft C 5.1]          "
  30.  
  31. #======================= Configuration ==================================
  32. RSPFILE = gawk.rsp
  33. #
  34. # Choose method for passing arguments to the linker.
  35. #
  36. # If compiling under OS/2 or if make can pass long lines
  37. #LDRSP = $(GAWKOBJS)
  38. #LINKRSP = $(LDRSP)
  39. #
  40. # else if make == dmake
  41. # Response files for linker: dmake allows the macro expansion
  42. #   $(macro_name:modifier_list:modifier_list:...)
  43. # The macro mktmp creates a temporary file for the linker. 
  44. # The 't' modifier is for tokenization. 
  45. #LDRSP =   @$(mktmp $(<:t"\n"))
  46. #LINKRSP = @$(mktmp $(<:t"+\n") ) # Space before final paren req
  47. #
  48. # else use brain-dead approach (emxbnd will need 'tr').
  49. RSP = $(RSPFILE)
  50. LDRSP = @$(RSP)
  51. LINKRSP = $(LDRSP)
  52. #------------------------------------------------------------------------
  53. # Some makes do not define MAKE (and ndmake does not allow a define).
  54. # Define MAK to be your make command.
  55. #MAK = $(MAKE) $(MAKEFILE)
  56. MAK = $(MAKE)
  57. #MAKEFILE = -f Makefile
  58. #MAK = make45 $(MAKEFILE)
  59. #------------------------------------------------------------------------
  60. # Define the base directory for the install. "make install" will install
  61. # in bin, lib/awk, man, and info under $(prefix)/. Most likely, you should
  62. # edit config.h so that $(prefix)/lib/awk appears as part of DEFPATH.
  63. #prefix =
  64. prefix = c:/gnu
  65. #
  66. # Define the install method. Method 1 is Unix-like (and requires cat,
  67. # cp, mkdir, sed, and sh); method 2 uses gawk and batch files.
  68. install = 1
  69. #========================================================================
  70. # End of general configuration. Some platform-specific configuration
  71. # notes appear below.
  72.  
  73.  
  74. #========================================================================
  75. #========================== DJGPP =======================================
  76. #========================================================================
  77.  
  78. LDJG = $(CC) $(LF) -o gawk $(LDRSP) $(LF2)
  79. #BDJG = coff2exe -s /djgpp/bin/go32.exe gawk
  80. BDJG = coff2exe gawk
  81.  
  82. djgpp:
  83.     $(MAK) all \
  84.     CC=gcc O=.o CF=-O \
  85.     LINK=LDJG LF=-s LF2=-lm \
  86.     BIND=BDJG
  87.  
  88. djgpp-debug:
  89.     $(MAK) all \
  90.     CC=gcc O=.o CF=-g \
  91.     LINK=LDJG LF2=-lm \
  92.     BIND=BDJG
  93.  
  94. #========================================================================
  95. #========================== EMX =========================================
  96. #========================================================================
  97.  
  98. # Link command for OS/2 versions.
  99. LEMX = $(CC) $(LF) -o $@ $(GAWKOBJS) gawk.def -lbsd $(LF2)
  100.  
  101. # Link and bind for DOS and OS/2 versions.
  102. # emx-09 needs '-p' emx option here or in EMXOPT environ var.
  103. LEMXBND = $(CC) $(LF) -o a.out $(LDRSP) gawk.def -lbsd $(LF2)
  104. BEMX = emxbind -b /emx/bin/emxl.exe a.out $@ -p
  105. #BEMX = emxbind -b /emx/bin/emx.exe a.out $@ -p
  106.  
  107. emx:
  108.     $(MAK) all \
  109.     "CC=gcc -Zomf" O=.obj "CF=-O -DOS2" \
  110.     LINK=LEMX "LF=-s -Zcrtdll -Zstack 512" RSP=
  111.  
  112. emxbnd:
  113.     $(MAK) all \
  114.     CC=gcc O=.o "CF=-O -DOS2 -DMSDOS" OBJ=popen.o \
  115.     LINK=LEMXBND LF=-s \
  116.     BIND=BEMX "P=|tr \" \" \"\n\""
  117.  
  118. emxbnd-debug:
  119.     $(MAK) all \
  120.     CC=gcc O=.o CF="-g -DOS2 -DMSDOS" OBJ=popen.o \
  121.     LINK=LEMXBND \
  122.     BIND=BEMX "P=|tr \" \" \"\n\""
  123.  
  124. #========================================================================
  125. #========================== MSC =========================================
  126. #========================================================================
  127.  
  128. # stdargv, glob, and director are from Stewartson's sh. These provide
  129. # globbing and enhanced argument-passing. MSC setargv.obj is a 
  130. # more limited alternative (and it will permit a bound version).
  131. #STDARGV = stdargv.obj glob.obj director.obj 
  132. STDARGV = setargv.obj
  133.  
  134. # Optimization and library options:
  135. # Os == optimize for size, Ot == optimize for speed, G2 == 286 or better
  136. #MSCOPT = -Os -G2
  137. MSCOPT = -Ot # -G2
  138. # Alternate lib, does not use math coprocessor.
  139. #MSCLIB = llibca
  140. #MSCCL = -FPa
  141. # Emulator lib, uses math coprocessor if present.
  142. MSCLIB = llibce
  143. MSCCL = -FPi
  144. #MSCCL = -FPc
  145.  
  146. LMSC = link $(LF) $(LINKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x6f00;
  147.  
  148. # CLMSC-linking works when building under OS/2
  149. CLMSC = $(CC) -o $@ $(LF) $(GAWKOBJS) $(STDARGV) $(LF2) -link /NOE/NOI/STACK:0x6f00
  150.  
  151. BMSC = bind $@ /n DOSMAKEPIPE DOSCWAIT
  152.  
  153. # Ugly hack: config.h defines __STDC__ if not defined on command-line.
  154. # OS/2 versions can't use -Za in getid.c. MSC7 uses stub headers in pc/ 
  155. # due to ANSI conflicts. MSC 5.1 defines __STDC__=0 regardless of ANSI flag.
  156.  
  157. # dmake-3.8 runs out of memory under DOS. Request that dmake
  158. # swap itself out on these targets. Note that this won't have
  159. # any affect on the bound OS/2 and DOS version of dmake-3.8.
  160.  
  161. .SWAP: msc msc-debug msc6 msc6os2 msc6bnd msc51 check
  162.  
  163. msc: 
  164.     $(MAK) all \
  165.     "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Ze -Ipc/include $(MSCOPT)" \
  166.     OBJ=popen.obj \
  167.     LINK=LMSC P=+
  168.  
  169. msc-debug: 
  170.     $(MAK) all \
  171.     "CC=cl $(MSCCL)" O=.obj "CF=-AL -Ze -Ipc/include -W2 -Zi -Od" \
  172.     OBJ=popen.obj \
  173.     LINK=LMSC LF2=/CO P=+
  174.  
  175. msc6: 
  176.     $(MAK) all \
  177.     "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Za $(MSCOPT)" \
  178.     OBJ=popen.obj \
  179.     LINK=LMSC P=+
  180.  
  181. msc6os2: 
  182.     $(MAK) all \
  183.     "CC=cl $(MSCCL)" O=.obj "CF=-AL -DOS2 -UMSDOS $(MSCOPT)" \
  184.     LINK=LMSC "LF2=p,gawk.def" P=+
  185.  
  186. msc6bnd:
  187.     $(MAK) all \
  188.     "CC=cl $(MSCCL)" O=.obj "CF=-AL -DOS2 $(MSCOPT)" \
  189.     OBJ=popen.obj \
  190.     LINK=LMSC "LF2=p,gawk.def" P=+ \
  191.     BIND=BMSC
  192.  
  193. # Support dropped in 3.0
  194. #msc51: 
  195. #    $(MAK) all \
  196. #    "CC=cl $(MSCCL)" O=.obj "CF=-AL -Za -D_MSC_VER=510 $(MSCOPT)" \
  197. #    OBJ=popen.obj \
  198. #    LINK=LMSC P=+
  199. #
  200. #msc51bnd:
  201. #    $(MAK) all \
  202. #    "CC=cl -AL ($MSCCL)" O=.obj "CF=-DOS2 -D_MSC_VER=510 $(MSCOPT)" \
  203. #    OBJ=popen.obj \
  204. #    LINK=CLMSC "LF=-Lp -Fb" "LF2=gawk.def"
  205.  
  206. #========================================================================
  207.  
  208. # Define BIND for BINDless compiles, otherwise $($(BIND)) may break.
  209. BIND = EMPTY
  210. EMPTY=
  211.  
  212. CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H
  213.  
  214. # object files
  215. AWKOBJS1 = array$O builtin$O eval$O field$O gawkmisc$O io$O main$O 
  216. AWKOBJS2 = missing$O msg$O node$O re$O version$O
  217. AWKOBJS = $(AWKOBJS1) $(AWKOBJS2)
  218.  
  219. ALLOBJS = $(AWKOBJS) awktab$O getid$O $(OBJ)
  220.  
  221. # GNUOBJS
  222. #    GNU stuff that gawk uses as library routines.
  223. GNUOBJS= getopt$O getopt1$O regex$O dfa$O
  224.  
  225. GAWKOBJS = $(ALLOBJS) $(GNUOBJS)
  226.  
  227. # clear out suffixes list
  228. # .SUFFIXES:
  229. .SUFFIXES: .c $O
  230.  
  231. .c$O:
  232.     $(CC) -c $(CFLAGS) $<
  233.  
  234. # rules to build gawk
  235. all : gawk.exe
  236.  
  237. gawk.exe:: $(ALLOBJS) $(GNUOBJS) $(RSP)
  238.     $($(LINK))
  239.     $($(BIND))
  240.     
  241. $(RSPFILE) : $(GAWKOBJS)
  242.     echo $(AWKOBJS1)$P > $@
  243.     echo $(AWKOBJS2)$P >> $@
  244.     echo awktab$O getid$O $(OBJ) $(GNUOBJS)$P >> $@
  245.  
  246. $(ALLOBJS):    awk.h dfa.h regex.h config.h
  247.  
  248. gawkmisc$O:    pc/gawkmisc.pc
  249.  
  250. getopt$O:    getopt.h
  251.  
  252. getopt1$O:    getopt.h
  253.  
  254. main$O:    patchlevel.h
  255.  
  256. # A bug in ndmake requires the following rule
  257. awktab$O: awk.h awktab.c
  258.     $(CC) -c $(CFLAGS) awktab.c
  259.  
  260. awktab.c:    awk.y
  261.     bison -o $@ awk.y
  262.  
  263. alloca$O:    alloca.c
  264.  
  265. #.PRECIOUS: install
  266. #.PHONY: install
  267.  
  268. install: install$(install)
  269.  
  270. install1: 
  271.     echo extproc sh $(prefix)/bin/igawk.cmd > igawk.cmd
  272.     echo shift >> igawk.cmd
  273.     cat pc/awklib/igawk >> igawk.cmd
  274.     sed "s;igawk;$(prefix)/bin/igawk;" pc/awklib/igawk.bat > igawk.bat
  275.     sh mkinstal.sh $(prefix)/bin
  276.     sh mkinstal.sh $(prefix)/lib/awk $(prefix)/man/man1 $(prefix)/info
  277.     cp gawk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin
  278.     cp awklib/eg/lib/* pc/awklib/igawk.awk $(prefix)/lib/awk
  279.     cp doc/*.1 $(prefix)/man/man1
  280.     cp doc/gawk.info $(prefix)/info
  281.  
  282. # install2 is equivalent to install1, but doesn't require cp, sed, etc.
  283. install2:
  284.     gawk -v prefix=$(prefix) -f install.awk
  285.  
  286. clean:
  287.     rm -rf gawk gawk.exe *.o *.obj core a.out $(RSPFILE)
  288. #    cd doc && $(MAKE) clean
  289. #    cd test && $(MAKE) clean
  290. #    cd awklib && $(MAKE) clean
  291.  
  292. awklib/eg: doc/gawk.texi
  293.     rm -fr awklib/eg
  294.     sh -c "cd awklib && ../gawk -f extract.awk ../doc/gawk.texi"
  295.  
  296. check:
  297.     cd test && $(MAK) -k AWK=../gawk.exe
  298.  
  299. test:    check
  300.